package com.szhmxxkj.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;

/**
 * 阿里接口sdk配置
 * @author Administrator
 *
 */
@Configuration
@ConfigurationProperties(prefix="alibaba")
public class IAcsClientConfig {
	String regionId = "cn-hangzhou"; // 必填固定值，必须为“cn-hanghou”
	String accessKeyId = "your accessKey"; // 
	String accessKeySecret = "";// your accessSecret
	
	@Bean
	public IAcsClient iAcsClient() {
		// 若报Can not find endpoint to access异常，请添加以下此行代码
		// DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Alidns",
		// "alidns.aliyuncs.com");
		IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
		return new DefaultAcsClient(profile);
	}
}
